home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Opus5.5
/
ARexx.lha
/
ARexx
/
AFSUnDelete.dopus5
< prev
next >
Wrap
Text File
|
1996-07-19
|
4KB
|
151 lines
/*
$VER: AFSUnDelete.dopus5 1.0 (8.5.96)
Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
ARexx script for Directory Opus 5.5 to simplify the undelete function on
AFS (Ami-FileSafe) partitions. You can use the copy button to undelete
files, and renaming and deprotection will be taken care of for you.
Function : ARexx DOpus5:ARexx/AFSUnDelete.dopus5 {Qp}
*/
parse arg portname .
if portname='' then
portname='DOPUS.1'
address value portname
options results
options failat 21
if ~show('l','rexxsupport.library') then
call addlib('rexxsupport.library',0,-30)
lister query source
if rc>0 then do
dopus request '"No source selected." OK'
exit
end
parse var result handle .
lister set handle busy on
lister query handle path
parse var result device ':'
if ~exists(device':.DELDIR') then do
dopus request '"'device': is not a valid AFS device." OK'
lister set handle busy off
exit
end
lister empty handle
lister set handle title 'Reading .deldir...'
lister set handle path device':'
lister refresh handle full
filelist=showdir(device':.DELDIR','f',':')
do while filelist~=''
parse var filelist fullname ':' filelist
parse var fullname filename '@' slotno
fileinfo=statef(device':.DELDIR/'fullname)
parse var fileinfo . filesize . protbits days minutes ticks comment
lister add handle '"'slotno filename'"' filesize '-1' days*86400+minutes*60+ticks/50 protbits comment
end
lister set handle title 'AFS UnDelete'
lister refresh handle full
handlername='AFSUnDel'handle
lister set handle handler handlername quotes
call openport(handlername)
dopus addtrap 'Copy' handlername
lister set handle busy off
do until event='inactive'
if waitpkt(handlername) then do
packet=getpkt(handlername)
if packet~='00000000'x then do
event=getarg(packet,0)
handle=getarg(packet,1)
namestr=getarg(packet,2)
user=getarg(packet,3)
pathstr=getarg(packet,4)
qualifier=getarg(packet,6)
select
when event='Copy' then
call docopy
when event='doubleclick' then do
parse var namestr slotno ' ' filename
command doubleclick '"'device':.DELDIR/'filename'@'slotno'"'
end
otherwise
nop
end
call reply(packet,0)
end
end
end
call closeport(handlername)
exit
docopy:
if user=0 then do
dopus request '"No destination selected." OK'
return
end
lister query user handler
if ~(result='RESULT' | result='') then do
dopus request '"Destination is a custom lister!" OK'
return
end
lister query user path
parse var result destdevice ':'
if destdevice=device then do
dopus request '"Cannot undelete to the same device!" OK'
return
end
destpath=result
lister set handle busy on
lister set user busy on
lister set handle newprogress name bar abort
lister set handle newprogress title 'AFS UnDelete'
lister query handle selentries stem copyfile.
do i=0 to copyfile.count-1
parse var copyfile.i slotno ' ' filename
fullname=filename'@'slotno
lister set handle newprogress name filename
lister set handle newprogress bar copyfile.count i+1
command wait copyas '"'device':.DELDIR/'fullname'" "'filename'" TO "'destpath'"'
command wait protect '"'destpath||filename'" SET WD'
lister select handle '"'copyfile.i'"' off
lister query handle abort
if result then
leave
end
lister clear handle progress
lister set user busy off
lister refresh handle full
lister set handle busy off
lister read user '"'destpath'"' force
return